﻿using BookStore.Application.Dto;
using BookStore.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace BookStore.Application.User
{
    public class UserAppService : ApplicationService, IUserAppService
    {
        private readonly IRepository<Users> repository;

        public UserAppService(IRepository<Users> repository)
        {
            this.repository = repository;
        }
        public async Task<UserDto> GetAsync(string code, string password)
        {
            var user = await repository.GetAsync(a => a.Code == code && a.Password == password);
            var dto = ObjectMapper.Map<Users, UserDto>(user);
            return dto;
        }
    }
}
